package com.wc.alorithm_blue_bridge._数学知识.质数.质数;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/4/12 20:11
 * @description http://43.138.190.70:8888/p/LQ1031T
 */
public class Answer {
    static int N = (int) (1e7 + 6e6);
    static int[] primes = new int[N];
    static boolean[] st = new boolean[N];
    static int idx = 0;
    static int T, x;

    static void ola(int n) {
        st[0] = st[1] = true;
        for (int i = 2; i <= n; i++) {
            if (!st[i]) primes[++idx] = i;
            for (int j = 1; primes[j] <= n / i; j++) {
                st[i * primes[j]] = true;
                if (i % primes[j] == 0) break;
            }
        }
    }


    public static void main(String[] args) {
        ola(N - 1);
        Scanner sc = new Scanner(System.in);
        T = sc.nextInt();
        while (T-- > 0) {
            x = sc.nextInt();
            System.out.println(primes[x]);
        }
    }
}
